home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 November
/
CMCD1104.ISO
/
Software
/
Freeware
/
Grafica
/
galeroo
/
Setup Galleroo 3.4.exe
/
{app}
/
styles
/
Tiqur
/
gallery.xsl
Wrap
Extensible Markup Language
|
2004-09-20
|
17KB
|
418 lines
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:func="http://exslt.org/functions"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:math="http://exslt.org/math"
xmlns:str="http://exslt.org/strings"
xmlns:g="."
xmlns:galleroo="."
extension-element-prefixes="dyn func exsl math str g galleroo"
version='1.1'>
<xsl:include href="../Lib/galleroo.xsl" />
<xsl:output method="html" />
<!-- doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" indent="yes" -->
<!-- Galleroo Tiqur XSL XML->HTML stylesheet 1.0
Copyright 2004, all rights reserved, xyster.net
written: 2/7/04
modified:
author: xyster
comments:
-->
<xsl:param name="source-folder" />
<xsl:param name="sort-by">name</xsl:param>
<xsl:param name="title">Annotation Gallery</xsl:param>
<xsl:param name="sub-title">titles and comments</xsl:param>
<xsl:param name="text-color">#000000</xsl:param>
<xsl:param name="nav-background-color">#FFFFFF</xsl:param>
<xsl:param name="slide-background-color">#FFFFFF</xsl:param>
<xsl:param name="link-color">#000066</xsl:param>
<xsl:param name="visited-link-color">#990099</xsl:param>
<xsl:param name="active-link-color">#FF0000</xsl:param>
<xsl:param name="thumb-size">75</xsl:param>
<xsl:param name="html-file-prefix" />
<xsl:param name="nav-background-image" />
<xsl:param name="slide-background-image" />
<xsl:param name="font" />
<xsl:param name="nav-alignment">left</xsl:param>
<xsl:param name="do-auto-play-movies">no</xsl:param>
<xsl:param name="_preview">0</xsl:param>
<xsl:template match="list">
<!-- frameset -->
<xsl:call-template name="gal-emit-frameset">
<xsl:with-param name="preview" select="$_preview" />
<xsl:with-param name="title" select="$title" />
<xsl:with-param name="sub-title" select="$sub-title" />
<xsl:with-param name="nav-alignment" select="$nav-alignment" />
<xsl:with-param name="sort-by" select="$sort-by" />
<xsl:with-param name="thumb-size" select="$thumb-size" />
<xsl:with-param name="padding" select="40" />
<xsl:with-param name="html-file-prefix" select="$html-file-prefix" />
</xsl:call-template>
<!-- initial blank page -->
<xsl:call-template name="emit-start-slide">
<xsl:with-param name="title" select="$title" />
<xsl:with-param name="sub-title" select="$sub-title" />
<xsl:with-param name="html-file-prefix" select="$html-file-prefix" />
</xsl:call-template>
<!-- nav bar -->
<xsl:call-template name="emit-nav-bar">
<xsl:with-param name="alignment" select="$nav-alignment" />
<xsl:with-param name="sort-by" select="$sort-by" />
<xsl:with-param name="html-file-prefix" select="$html-file-prefix" />
</xsl:call-template>
<!-- generate the picture pages -->
<xsl:call-template name="emit-slides">
<xsl:with-param name="pix" select="media/object/children/object/children/object" />
<xsl:with-param name="title" select="$title" />
<xsl:with-param name="sub-title" select="$sub-title" />
<xsl:with-param name="do-auto-play-movies" select="$do-auto-play-movies" />
<xsl:with-param name="html-file-prefix" select="$html-file-prefix" />
</xsl:call-template>
<!-- generate the result page -->
<xsl:call-template name="emit-result-page">
<xsl:with-param name="html-file-prefix" select="$html-file-prefix" />
</xsl:call-template>
</xsl:template>
<!-- emit ye explanation slide -->
<xsl:template name="emit-start-slide">
<xsl:param name="title" />
<xsl:param name="sub-title" />
<xsl:param name="html-file-prefix" />
<html>
<head>
<title><xsl:value-of select="$title" /> - <xsl:value-of select="$sub-title" /></title>
</head>
<body class="slide-page">
<!-- title -->
<div align="center"><h1><xsl:value-of select="$title" /> - <xsl:value-of select="$sub-title" /></h1></div>
<div align="left">
<h2>Welcome</h2>
<p>
Please read all instructions before proceeding.<br />
Using this gallery you can annotate your images and create an annotation file for Galleroo to use
in the galleries it creates.
</p>
To start annotating your images click the thumbnails on the left.
When you click a thumbnail, this page will be replaced with a slide of the image and text boxes for you
to enter an image title, a caption and a detailed comment. You can leave any of the text boxes empty.
When you are satisfied with the descriptions you typed in, click 'Confirm' and continue
to the next image using the thumbnail bar on the left.<br />
When you are done annotating the images, click the 'Create Info File' link. You can find the link on the
bottom of the thumbnail bar or on the top left of any slide page. The 'Create Info File' link will
create the text required for Galleroo to annotate your images and provide you with the instructions
written below so you don't have to memorize them.<br />
Once you have created the annotation text, create a file named 'info.txt' in the source folder,
<xsl:value-of select="$source-folder" />,
and copy the text from the page into the file and save it. Galleroo will
now use the annotation file when creating galleries for the images in the source folder.
</div>
<!-- lister signature -->
<div style="padding: 5em;">
<xsl:call-template name="gal-emit-signature" />
</div>
</body>
</html>
<!-- cutter output -->
<xsl:text> </xsl:text>
<xsl:comment>CUTHERE: <xsl:value-of select="galleroo:rplstr($html-file-prefix, '-', '\-')" />blank.html ?</xsl:comment>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template name="emit-result-page">
<xsl:param name="html-file-prefix" />
<html>
<head>
<title>Galleroo User Info</title>
<script language="javascript">
function generate()
{
var text;
text = "";
for (i = 1; i <= <xsl:number value="count(media/object/children/object/children/object)" />; i++)
{
text += parent.navFrame.info[i].file + "\n";
text += parent.navFrame.info[i].title + "\n";
text += parent.navFrame.info[i].caption + "\n";
text += parent.navFrame.info[i].comment + "\n\n";
}
document.forms["result"].text.value = text;
document.forms["result"].text.focus();
document.forms["result"].text.select();
}
</script>
</head>
<body class="slide-page" onload="generate()">
<form name="result">
<div align="center">
<h1>Ready!</h1>
</div>
<div align="center">
<h2>Create a file named 'info.txt' in the gallery source folder, <xsl:value-of select="$source-folder" />. Copy and paste the text below into
'info.txt' and save the file. Galleroo will now use the information in 'info.txt' to
annotate galleries!</h2>
</div>
<div align="center">
<textarea name="text" cols="60" rows="20">
</textarea>
</div>
</form>
<!-- lister signature -->
<xsl:call-template name="gal-emit-signature" />
</body>
</html>
<!-- cutter output -->
<xsl:text> </xsl:text>
<xsl:comment>CUTHERE: <xsl:value-of select="galleroo:rplstr($html-file-prefix, '-', '\-')" />result.html ?</xsl:comment>
<xsl:text> </xsl:text>
</xsl:template>
<!-- Navigation Bar -->
<xsl:template name="emit-nav-bar">
<xsl:param name="alignment" />
<xsl:param name="sort-by" />
<xsl:param name="html-file-prefix" />
<xsl:variable name="quot">"</xsl:variable>
<xsl:variable name="apos">'</xsl:variable>
<html>
<head>
<title>Galleroo Nav Bar</title>
<script language="javascript">
if (typeof HTMLElement != 'undefined')
{
eval("HTMLElement.prototype.innerText getter = function() { return this.innerHTML.replace(/<<xsl:text>[</xsl:text>^><xsl:text>]</xsl:text>+>/g,''); }");
eval("HTMLElement.prototype.innerText setter = function(txtStr) { var parsedText = document.createTextNode(txtStr); this.innerHTML = ''; this.appendChild( parsedText ); }");
}
var info = new Array(<xsl:number value="count(media/object/children/object/children/object)" />);
<xsl:for-each select="media/object/children/object/children/object">
<xsl:sort select="attrib/*[name()=$sort-by]" />
info[<xsl:number />] = new Object;
info[<xsl:number />].file = "<xsl:value-of select="attrib/name" />";
info[<xsl:number />].title = "<xsl:value-of select="translate(galleroo:image-title(attrib), $quot, $apos)" />";
info[<xsl:number />].caption = "<xsl:value-of select="translate(attrib/user-caption, $quot, $apos)" />";
info[<xsl:number />].comment = "<xsl:value-of select="translate(galleroo:image-comment(attrib), $quot, $apos)" />";
</xsl:for-each>
function notify(n)
{
<!-- XXX come up with a better way to do this...
-->
document.links[n * 2].innerText = info[n].title;
}
</script>
</head>
<body class="index-page">
<xsl:choose>
<!-- vertical nav bar -->
<xsl:when test="$alignment = 'left' or $alignment = 'right'">
<!-- home link -->
<div align="center">
<a href="../index.html" target="_top">Home</a>
</div>
<div align="center">
<table class="thumb-table" align="center" border="0">
<xsl:for-each select="media/object/children/object/children/object">
<xsl:sort select="attrib/*[name()=$sort-by]" />
<tr>
<td align="center"><a target="main" href="{$html-file-prefix}{attrib/name}.html"><img class="thumb" width="{attrib/thumb-x-size}" height="{attrib/thumb-y-size}" src="{attrib/thumb-path}/{attrib/thumb-name}" border="0" /></a></td>
</tr>
<tr>
<td align="center"><a name="n{position()}" target="main" href="{$html-file-prefix}{attrib/name}.html"><xsl:value-of select="galleroo:image-title(attrib)" /></a>
</td>
</tr>
</xsl:for-each>
</table>
</div>
</xsl:when>
<!-- horizontal nav bar -->
<xsl:otherwise>
<!-- home link -->
<div align="left">
<a href="../index.html" target="_top">Home</a>
</div>
<!-- thumbnails -->
<div align="center">
<table class="thumb-table" align="center" border="0">
<tr>
<xsl:for-each select="media/object/children/object/children/object">
<xsl:sort select="attrib/*[name()=$sort-by]" />
<td align="center"><a target="main" href="{$html-file-prefix}{attrib/name}.html"><img class="thumb" width="{attrib/thumb-x-size}" height="{attrib/thumb-y-size}" src="{attrib/thumb-path}/{attrib/thumb-name}" border="0" /></a></td>
</xsl:for-each>
</tr>
<tr>
<xsl:for-each select="media/object/children/object/children/object">
<xsl:sort select="attrib/*[name()=$sort-by]" />
<td align="center">
<a name="n{position()}" target="main" href="{$html-file-prefix}{attrib/name}.html"><xsl:value-of select="galleroo:image-title(attrib)" /></a>
</td>
</xsl:for-each>
</tr>
</table>
</div>
</xsl:otherwise>
</xsl:choose>
<div align="center" style="padding:.5em;">
<a target="main" href="{$html-file-prefix}result.html"><h1>Create Info File</h1></a>
</div>
</body>
</html>
<!-- cutter output -->
<xsl:text> </xsl:text>
<xsl:comment>CUTHERE: <xsl:value-of select="galleroo:rplstr($html-file-prefix, '-', '\-')" />nav.html ?</xsl:comment>
<xsl:text> </xsl:text>
</xsl:template>
<!-- emit ye simple slide pages -->
<xsl:template name="emit-slides">
<xsl:param name="pix" />
<xsl:param name="title" />
<xsl:param name="sub-title" />
<xsl:param name="do-auto-play-movies" />
<xsl:param name="html-file-prefix" />
<xsl:for-each select="$pix">
<xsl:sort select="attrib/*[name()=$sort-by]" />
<html>
<xsl:comment> Transformed from XML with Galleroo XSL stylesheet 1.0</xsl:comment>
<xsl:comment> Source path='<xsl:value-of select="$source-root/list/media/basepath" />' </xsl:comment>
<head>
<title><xsl:value-of select="galleroo:image-title(attrib)" /><xsl:value-of select="galleroo:image-caption(attrib)" /></title>
<script language="javascript">
function setup()
{
document.forms["note"].title.value = parent.navFrame.info[<xsl:number />].title;
document.forms["note"].caption.value = parent.navFrame.info[<xsl:number />].caption;
document.forms["note"].comment.value = parent.navFrame.info[<xsl:number />].comment;
}
function save()
{
// first make sure the comment does not have empty lines in it
var comment = document.forms["note"].comment.value;
var i, j;
for (i = 0; i < comment.length; i++)
{
if (comment.charAt(i) == '\n')
{
j++;
if (j == 2)
{
alert("Cannot save a comment with an empty line. Please remove any empty lines in the comment.");
return;
}
} else
{
j = 0;
}
}
// if all is ok, then save
parent.navFrame.info[<xsl:number />].title = document.forms["note"].title.value;
parent.navFrame.info[<xsl:number />].caption = document.forms["note"].caption.value;
parent.navFrame.info[<xsl:number />].comment = document.forms["note"].comment.value;
parent.navFrame.notify(<xsl:number />);
}
</script>
</head>
<body class="slide-page" onload="setup()">
<form name="note">
<div align="left">
<h2><a href="{$html-file-prefix}result.html">Create Info File</a> | <a href="{$html-file-prefix}blank.html">Review Instructions</a></h2>
</div>
<!-- image -->
<xsl:call-template name="gal-emit-image">
<xsl:with-param name="do-auto-play-movies" select="$do-auto-play-movies" />
</xsl:call-template>
<!-- subtitle -->
<div style="text-align:center; margin-left:auto; margin-right:auto; align:center; padding:.5em;">
Title: <input size="40" name="title" value="" /> -
<input size="40" name="caption" value="" /> :Caption
</div>
<!-- comment -->
<!-- IE is retarded and won't honor style placement directives when it has a textarea or button in it -->
<div align="center" style="padding:.5em;">
Comment:<br/>
<textarea name="comment" cols="50" rows="10"> </textarea>
</div>
<div align="center" style="padding:.5em;">
Please note: a comment can have as many lines as you want but
it cannot have any empty lines.
</div>
<div align="center" style="padding:.5em;">
<input type="button" value=" Confirm " onClick="save();" name="button" />
</div>
<!-- lister signature -->
<xsl:call-template name="gal-emit-signature" />
</form>
</body>
</html>
<!-- cutter output -->
<xsl:text> </xsl:text>
<xsl:comment>CUTHERE: <xsl:value-of select="galleroo:rplstr(concat($html-file-prefix, attrib/name), '-', '\-')" />.html ?</xsl:comment>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>